package com.ayg.controller;

import com.ayg.pojo.TrainingPlans;
import com.ayg.service.TrainingPlanService;
import com.ayg.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/training")
@CrossOrigin
public class TrainingPlanController {

    @Autowired
    private TrainingPlanService trainingPlanService;

    /**
     * 添加培养计划
     * @param trainingPlans
     * @return
     */
    @PostMapping("/AddTrainingPlan")
    public SysResult AddTrainingPlan(@RequestBody TrainingPlans trainingPlans) {
        trainingPlanService.AddTrainingPlan(trainingPlans);
      return SysResult.success();
    }

    /**
     * 查询培养计划
     * @return
     */
    @GetMapping("/getTrainingPlan")
    public SysResult getTrainingPlan(){
        List<TrainingPlans> list=trainingPlanService.getTrainingPlan();
        return SysResult.success(list);
    }

    /**
     * 添加学习培养计划第二级
     * @param trainingPlans
     * @return
     */
    @PostMapping("/AddTrainingStudy")
    public SysResult AddTrainingStudy(@RequestBody TrainingPlans trainingPlans) {
        trainingPlanService.LearningCultivate(trainingPlans);
        return SysResult.success();
    }

    /**
     * 查询培养计划第二级
     * @param trainingPlan
     * @return
     */
    @GetMapping("/AddOneTrainingPlan")
    public SysResult AddOneTrainingPlan(String trainingPlan){
        List<TrainingPlans> list=trainingPlanService.AddOneTrainingPlan(trainingPlan);
        return SysResult.success(list);
    }

    /**
     * 查询第二级parent_id=1
     * @param trainingPlans
     * @return
     */
    @GetMapping("/AddSecondTrainingPlan")
    public SysResult AddSecondTrainingPlan(TrainingPlans trainingPlans){
        List<TrainingPlans> list=trainingPlanService.AddSecondTrainingPlan(trainingPlans);
        return SysResult.success(list);
    }

    /**
     * 添加兴趣培养计划第二级
     * @param trainingPlans
     * @return
     */
    @PostMapping("/AddTrainingInteres")
    public SysResult AddTrainingInteres(@RequestBody TrainingPlans trainingPlans) {
        trainingPlanService.interestCultivation(trainingPlans);
        return SysResult.success();
    }

    /**
     * 添加生活技能掌握第二级
     * @param trainingPlans
     * @return
     */
    @PostMapping("/AddTrainingSkill")
    public SysResult AddTrainingSkill(@RequestBody TrainingPlans trainingPlans) {
        trainingPlanService.SkillCultivation(trainingPlans);
        return SysResult.success();
    }

    /**
     * 添加获得荣誉第二级
     * @param trainingPlans
     * @return
     */
    @PostMapping("/AddTrainingHonor")
    public SysResult AddTrainingHonor(@RequestBody TrainingPlans trainingPlans) {
        trainingPlanService.HonorCultivation(trainingPlans);
        return SysResult.success();
    }

    /**
     * AddInnerDrawerTrainingPlan
     */
    @GetMapping("/AddInnerDrawerTrainingPlan")
    public SysResult AddInnerDrawerTrainingPlan(TrainingPlans trainingPlans){
        List<TrainingPlans> list=trainingPlanService.AddInnerDrawerTrainingPlan(trainingPlans);
        return SysResult.success(list);
    }

    @GetMapping("/getBrowseTrainingList")
    public SysResult getBrowseTrainingList(){
        List<TrainingPlans> list=trainingPlanService.getBrowseTrainingList();
        return SysResult.success(list);
    }


}
